<template>
  <el-tabs v-model="activeName">
    <el-tab-pane label="主要配置" name="MainConfig">
      <el-form-item label="公司名：">
        <el-input v-model="configValue.copyrightContext" placeholder="请输入公司名称"/>
      </el-form-item>

      <el-form-item label="备案号：">
        <el-input v-model="configValue.copyrightNumber" placeholder="请输入备案号"/>
      </el-form-item>

      <el-divider border-style="dashed" content-position="left"></el-divider>

      <el-form-item label="密码错误次数：">
        <el-input-number v-model="configValue.passwordMaxWrongCount" :min="3" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="异常锁定时间：">
        <el-input-number v-model="configValue.passwordMaxWrongLockTime" :min="30" :precision="0" :step="1" controls-position="right"/>
        <span class="tip">密码 错误次数达到限制后锁定时间(单位:秒)</span>
      </el-form-item>

      <el-form-item label="地址异常次数：">
        <el-input-number v-model="configValue.addressMaxAbnormalCount" :min="5" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="异常锁定时间：">
        <el-input-number v-model="configValue.addressMaxAbnormalLockTime" :min="300" :precision="0" :step="1" controls-position="right"/>
        <span class="tip">Ip地址 异常次数达到限制后锁定时间(单位:秒)</span>
      </el-form-item>
    </el-tab-pane>

    <el-tab-pane label="验证码配置" name="CaptchaConfig">
      <el-form-item label="类型：">
        <el-select v-model="captchaConfig.codeType" placeholder="请选择验证码类型">
          <el-option key="arithmetic" label="算数" value="arithmetic"/>
          <el-option key="chinese" label="中文" value="chinese"/>
          <el-option key="chinese_gif" label="中文闪图" value="chinese_gif"/>
          <el-option key="gif" label="闪图" value="gif"/>
          <el-option key="spec" label="默认" value="spec"/>
        </el-select>
      </el-form-item>

      <el-form-item label="有效期：">
        <el-input-number v-model="captchaConfig.expiration" :min="30" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="内容长度：">
        <el-input-number v-model="captchaConfig.length" :min="2" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="宽度：">
        <el-input-number v-model="captchaConfig.width" :min="80" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="高度：">
        <el-input-number v-model="captchaConfig.height" :min="20" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>

      <el-form-item label="字体大小：">
        <el-input-number v-model="captchaConfig.fontSize" :min="10" :precision="0" :step="1" controls-position="right"/>
      </el-form-item>
    </el-tab-pane>
  </el-tabs>
</template>

<script lang="ts" setup>
import { ref } from 'vue';

defineOptions({name: 'SysLoginConfig'})

const props = defineProps({
  configValue: {
    type: Object,
    required: true
  },
  configType: {
    type: Number,
    default: 0,
    required: true
  },
  readonly: {
    type: Boolean,
    default: false
  },
  captchaConfig: {
    type: Object,
    required: true
  },
});

const activeName = ref('MainConfig');
</script>

<style lang="scss" scoped>

</style>
